package com.cldz.controller;

import com.cldz.common.dto.req.FsuDto;
import com.cldz.common.dto.req.FsuSpDto;
import com.cldz.common.dto.res.FsuDeviceResDto;
import com.cldz.common.dto.res.FsuResDto;
import com.cldz.common.dto.res.FsuSpResDto;
import com.cldz.feign.FsuFeign;
import com.cldz.response.support.ServerResponse;
import com.cldz.common.dto.req.FsuDeviceDto;
import com.cldz.service.FsuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ Author     ：lixiao.
 * @ Date       ：Created in 9:37 2018/12/21
 * @ Description：获取FSU设备列表类接口
 * @ Modified By：
 */
@Slf4j
@RestController
public class FsuController implements FsuFeign {

    @Autowired
    private FsuService fsuService;

    /**
     * 获取指定区域下设备列表(FSU)
     * @param fsuDto
     * @return
     */
    @GetMapping("/fsuGetDevices")
    public ServerResponse getFsuGetDevices(FsuDto fsuDto){
        List<FsuResDto> fsuGetDevices = fsuService.getFsuGetDevices(fsuDto);
        Integer fsuGetDevicesAmount = fsuService.getFsuGetDevicesAmount(fsuDto);
        return ServerResponse.createDataAndCount(fsuGetDevicesAmount,fsuGetDevices);
    }

    /**
     * 获取指定站点下设备列表(FSU)
     * @param fsuDto
     * @return
     */
    @GetMapping("/fsuGetDevicesWithStation")
    public ServerResponse getFsuGetDevicesWithStation(FsuDto fsuDto){
        List<FsuResDto> fsuGetDevicesWithStation = fsuService.getFsuGetDevicesWithStation(fsuDto);
        Integer fsuGetDevicesWithStationAmount = fsuService.getFsuGetDevicesWithStationAmount(fsuDto);
        return ServerResponse.createDataAndCount(fsuGetDevicesWithStationAmount,fsuGetDevicesWithStation);
    }

    /**
     * 获取指定设备信息(FSU)
     * @param suID
     * @return
     */
    @GetMapping("/fsuGetSpecifyDevice/{suID}")
    public ServerResponse getFsuGetSpecifyDevice(@PathVariable(name = "suID")String suID){
        FsuDto fsuDto = fsuService.getFsuGetSpecifyDevice(suID);
        return ServerResponse.createDataList(fsuDto);
    }

    /**
     * 获取子设备列表(FSU)
     * @param suID
     * @return
     */
    @GetMapping("/fsuGetSunDev/{suID}")
    public ServerResponse getFsuGetSunDev(@PathVariable(name = "suID")String suID){
        List<FsuDeviceResDto> fsuDeviceDto = fsuService.getFsuGetSunDev(suID);
        return ServerResponse.createDataList(fsuDeviceDto);
    }

    /**
     * 获取监控点信息(FSU)
     * @return
     */
    @GetMapping("/fsuGetSpID")
    public ServerResponse getFsuGetSpID(FsuSpDto fsuSpDto){
        List<FsuSpResDto> list = fsuService.getFsuGetSpID(fsuSpDto);
        return ServerResponse.createDataList(list);
    }



}
